package com.adee.nowcoder.huawei;

import java.util.Scanner;

public class T017_HJ17 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            String[] arr = str.split(";");
            int x = 0, y = 0;
            for(int i = 0; i < arr.length; i++) {
                String s = arr[i].trim();
                if(s.length() == 0) continue;
                char c = s.charAt(0);
                int v = 0;
                try {
                    v = Integer.parseInt(s.substring(1));
                } catch(Exception e){
                    continue;
                }
                if(c == 'A') {
                    x -= v;
                } else if(c == 'D') {
                    x += v;
                } else if(c == 'W') {
                    y += v;
                } else if(c == 'S') {
                    y -= v;
                }
            }
            System.out.printf("%d,%d", x, y);
        }
    }
}
